#!/bin/bash

if [ $# -eq 0 ]; then
    echo "Please give your example"
    exit 1
fi

for file in "$@"; do
    if [ -f "$file" ]; then
        cat "$file"
    elif [ -d "$file" ]; then
        tar -czf "$file.tar.gz" "$file"
    elif [[ "$file" == *.tar.gz ]]; then
        tar -xzf "$file"
    else
        echo "Error"
    fi
done
